package com.ir;

import com.asm.DirectMemoryReference;
import com.asm.MemoryReference;
import com.asm.Symbol;
import com.sysdep.CodeGenerator;

public class FloatIR extends Expr {
    String name;
    float value;
    MemoryReference reference;

    public FloatIR(String name, float value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public float getValue() {
        return value;
    }

    public MemoryReference getReference() {
        if (reference == null) {
            System.out.println("flt is null");
        }
        return reference;
    }

    public void setMemoryReference(Symbol sym, long offset) {
        reference = new DirectMemoryReference(sym, offset, false);
    }

    @Override
    public boolean accept(CodeGenerator cg) {
        return cg.visit(this);
    }

    @Override
    public int getIntValue() {
        return (int) value;
    }
}
